<style>
.buybid-box .buybid-content .buybid-list ul li {
    height: 462px;
}
.buybid-box .buybid-content .buybid-list ul li .buy-btn {
    height: 80px;
    margin: 60px 0 0 0;
}
.buybid-box .buybid-content .buybid-list ul li .buy-btn .buynow {
    margin-top: 23px;
}
.buybid-box .buybid-content{
	padding: 20px 0 0 0px;
}
.buybid-box .buybid-content .buybid-list ul li{
	width:172px;
}
.buybid-box .buybid-content .buybid-list ul li .buy-btn {
    margin: 60px 0 0 1px;
    width: 198px;
}
</style>
    <title><?php echo CHtml::encode($this->pageTitle); ?></title>

<div class='buybid-box'>
	<div class='buybid-top'>
		<div class='buybid-title'>Bid Packs</div>
	</div>
	<div class="coupon-box">
        	<p>Enter Coupon:</p><input type="text" name="coupon_code" id="coupon_code" class="form-control coupon_code" /><a href="#" id="apply_coupon_code" class="apply"><button class="btn btn-bid-auction buynow">APPLY</button></a>
        </div>
	<div class='buybid-content'>
		<div class='buybid-list'>
			<ul>
				<?php foreach ($bids as $k => $v) {
					
				?>
				<li class='shoplist'>
				<p class='shop-title'><?php  echo $v->title?></p>
				<p class='shop-img'><img name="" src="<?php echo $url[$k]->path?$url[$k]->path:Yii::app()->resource->path('img') . '/no-image.png' ?>" width="198" height="329" alt="Bids" /></p>	
				<p class="buy-btn">
  						<button class="btn btn-bid-auction buynow"  onclick="buybidPack(<?php  echo $v->id?>)">BUY NOW</button>
				</p>	
  				</li>
  				<?php }?>
  				

			</ul>
		</div>

	</div>
</div>
<script type="text/javascript">
/**
	购买bidPack时触发
*/
function  buybidPack(bidPackId){
	var bidPackPrice=37.5;
	switch(bidPackId){
		case 10:
		    bidPackPrice=37.5;
			break;
		case 11:
			bidPackPrice=70;
			break;
		case 12:
			bidPackPrice=175;
			break;
		case 13:
			bidPackPrice=325;
			break;
		case 14:
			bidPackPrice=650;
			break;
	}
	ga('send', 'event', { eventCategory: 'bidpack', eventAction: 'purchase', eventValue: bidPackPrice});
	window.location.href="<?php echo yii::app()->baseUrl?>/buybid/payment/"+bidPackId;
}

$(document).ready(function(){
    <?php
    if(Yii::app()->session['_responder_mark']){
        unset(Yii::app()->session['_responder_mark']);
        echo "alert('Invalid: Invalid Coupon Code.')";
    }
    ?>

	$("#apply_coupon_code").click(function(){
		$url = '<?php echo yii::app()->baseUrl?>/ajax/ajaxcouponcodevalid/';
		$couponCode = $('#coupon_code').val();
		$.ajax({
			type: 'get',
            url: $url,
            data: {'couponCode':$couponCode},
            dataType: "json",
            success: function(response){
                if(response==1){
//                    $('.buy-now-btn').attr('href',$('.buy-now-btn').attr('href')+'/couponCode/'+$("#coupon_code").val());
                    window.location.href = '<?php echo yii::app()->baseUrl?>/buybid/couponcode/couponcode/'+$("#coupon_code").val();
//					alert('Coupon Available!');
                }else{
                	alert(response);
                }
            }
		});
		return false;
	});
});
</script>